﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZSZ.Service.Entity;

namespace ZSZ.Service.EntityConfig
{
    class HouseConfig: EntityTypeConfiguration<HouseEntity>
    {
        public HouseConfig() {
            this.ToTable("T_House");
            this.HasRequired(h => h.Community).WithMany().HasForeignKey(h=>h.CommunityId).WillCascadeOnDelete(false);
            this.HasRequired(h => h.RoomType).WithMany().HasForeignKey(h=>h.RommTypeId).WillCascadeOnDelete(false);
            this.HasRequired(h => h.Status).WithMany().HasForeignKey(h=>h.StatusId).WillCascadeOnDelete(false);
            this.HasRequired(h => h.DecorateStatus).WithMany().HasForeignKey(h=>h.DecorateStatusId);
            this.HasRequired(h => h.Type).WithMany().HasForeignKey(h=>h.TypeId).WillCascadeOnDelete(false);
        }
    }
}
